package zw_401_500.zw_485_最大连续1的个数;

import java.util.Arrays;

class Solution {
    public static void main(String[] args) {
        int[] nums = {0};
        int ones = findMaxConsecutiveOnes(nums);
        System.out.println(ones);
    }

    public static int findMaxConsecutiveOnes(int[] nums) {
        int maxCount = 0, count = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] == 1) {
                count++;
            } else {
                maxCount = count > maxCount ? count : maxCount;
                count = 0;
            }
        }
        return maxCount = count > maxCount ? count : maxCount;
    }
}